package rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.dao;

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.NoResultException;
import javax.persistence.Query;

import rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.entitet.Putnik;

@Stateless
@Local(PutnikDao.class)
public class PutnikDaoBean extends GenerickiDaoBean<Putnik, Integer> implements
		PutnikDao {

	@Override
	public Double ukupnaCenaKoriscenihUsluga(int putnikId) {
		Double cena = null;
		try {
			Query upit = em.createNamedQuery("ukupnaCenaKoriscenihUsluga")
					.setParameter("putnikId", putnikId);

			cena = (Double) upit.getSingleResult();
		} catch (NoResultException ex) {
			// TODO obraditi izuzetak
		}

		return cena;
	}

}
